import { _decorator, Animation, Component, find, Node } from 'cc';
import { GameManager, GameState } from '../GameManager';
const { ccclass, property } = _decorator;

@ccclass('Ships_Saucer')
export class Ships_Saucer extends Component {

    @property(Animation)
    anim:Animation = null;
    

    start() {

    }

    update(deltaTime: number) {

        const newPos=this.node.getWorldPosition();
        const playerPos=find("Canvas/Player").getWorldPosition();
        if(newPos.y<playerPos.y){
            if(GameManager.getInstance().gameState==GameState.START){
                this.attack();
            }
        }
    }

    attack(){
        this.anim.play("ships_saucer_Standbymode_0");
    }
}
//血条,道具系统,金币系统,结束UI,关卡系统
// 三种护盾：护盾，装甲，结构
//近战武器可以切削非穿透性子弹
//有辅助恢复其他怪护盾的后勤怪,后勤怪速度很慢，不会太靠近玩家
//3种子弹伤害类型,激光对护盾伤害高,爆炸效果对装甲伤害高,近战对结构伤害高,普通子弹对所有护盾类型伤害相同但是伤害没有明显特征
//先初步实现基础血条


